FileUploader = require "./../../../common/file-uploader/index.coffee"

$ () ->
    imgKeyValue1 = null

    new FileUploader {
        click_button: "upload1_btn",
        show_img: "cn_img1",
        domain: "http://ozjihfhke.bkt.clouddn.com",
        browse_button: "upload1",
        container: "img-wrapper1",
    }, {
        FileUploader: (up, file, info) ->
            imgKeyValue1 = info.key
    }

    $("#update_btn").click (e) ->
        param = 
            id: $("#id").val()
            title:$("#title").val()
            abstract: $("#abstract").val()
            cover: imgKeyValue1
            content: $("#content").val()

        $.post '/api/admin/article/update',param,(res) ->
            if res.status.errCode is 0
                alert "修改成功"
            else
                alert res.status.message